Optimal. Leaf size=118 \[ \frac {b \sec (c+d x) (b-a \sin (c+d x))}{a d \left (a^2-b^2\right )}+\frac {2 b^3 \tan ^{-1}\left (\frac {a \tan \left (\frac {1}{2} (c+d x)\right )+b}{\sqrt {a^2-b^2}}\right )}{a d \left (a^2-b^2\right )^{3/2}}+\frac {\sec (c+d x)}{a d}-\frac {\tanh ^{-1}(\cos (c+d x))}{a d} \]
[Out]
________________________________________________________________________________________
Rubi [A] time = 0.23, antiderivative size = 118, normalized size of antiderivative = 1.00, number of steps used = 10, number of rules used = 9, integrand size = 27, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.333, Rules used = {2898, 2622, 321, 207, 2696, 12, 2660, 618, 204} \[ \frac {2 b^3 \tan ^{-1}\left (\frac {a \tan \left (\frac {1}{2} (c+d x)\right )+b}{\sqrt {a^2-b^2}}\right )}{a d \left (a^2-b^2\right )^{3/2}}+\frac {b \sec (c+d x) (b-a \sin (c+d x))}{a d \left (a^2-b^2\right )}+\frac {\sec (c+d x)}{a d}-\frac {\tanh ^{-1}(\cos (c+d x))}{a d} \]
Antiderivative was successfully verified.
[In]
[Out]
Rule 12
Rule 204
Rule 207
Rule 321
Rule 618
Rule 2622
Rule 2660
Rule 2696
Rule 2898
Rubi steps
\begin {align*} \int \frac {\csc (c+d x) \sec ^2(c+d x)}{a+b \sin (c+d x)} \, dx &=\int \left (\frac {\csc (c+d x) \sec ^2(c+d x)}{a}-\frac {b \sec ^2(c+d x)}{a (a+b \sin (c+d x))}\right ) \, dx\\ &=\frac {\int \csc (c+d x) \sec ^2(c+d x) \, dx}{a}-\frac {b \int \frac {\sec ^2(c+d x)}{a+b \sin (c+d x)} \, dx}{a}\\ &=\frac {b \sec (c+d x) (b-a \sin (c+d x))}{a \left (a^2-b^2\right ) d}+\frac {b \int \frac {b^2}{a+b \sin (c+d x)} \, dx}{a \left (a^2-b^2\right )}+\frac {\operatorname {Subst}\left (\int \frac {x^2}{-1+x^2} \, dx,x,\sec (c+d x)\right )}{a d}\\ &=\frac {\sec (c+d x)}{a d}+\frac {b \sec (c+d x) (b-a \sin (c+d x))}{a \left (a^2-b^2\right ) d}+\frac {b^3 \int \frac {1}{a+b \sin (c+d x)} \, dx}{a \left (a^2-b^2\right )}+\frac {\operatorname {Subst}\left (\int \frac {1}{-1+x^2} \, dx,x,\sec (c+d x)\right )}{a d}\\ &=-\frac {\tanh ^{-1}(\cos (c+d x))}{a d}+\frac {\sec (c+d x)}{a d}+\frac {b \sec (c+d x) (b-a \sin (c+d x))}{a \left (a^2-b^2\right ) d}+\frac {\left (2 b^3\right ) \operatorname {Subst}\left (\int \frac {1}{a+2 b x+a x^2} \, dx,x,\tan \left (\frac {1}{2} (c+d x)\right )\right )}{a \left (a^2-b^2\right ) d}\\ &=-\frac {\tanh ^{-1}(\cos (c+d x))}{a d}+\frac {\sec (c+d x)}{a d}+\frac {b \sec (c+d x) (b-a \sin (c+d x))}{a \left (a^2-b^2\right ) d}-\frac {\left (4 b^3\right ) \operatorname {Subst}\left (\int \frac {1}{-4 \left (a^2-b^2\right )-x^2} \, dx,x,2 b+2 a \tan \left (\frac {1}{2} (c+d x)\right )\right )}{a \left (a^2-b^2\right ) d}\\ &=\frac {2 b^3 \tan ^{-1}\left (\frac {b+a \tan \left (\frac {1}{2} (c+d x)\right )}{\sqrt {a^2-b^2}}\right )}{a \left (a^2-b^2\right )^{3/2} d}-\frac {\tanh ^{-1}(\cos (c+d x))}{a d}+\frac {\sec (c+d x)}{a d}+\frac {b \sec (c+d x) (b-a \sin (c+d x))}{a \left (a^2-b^2\right ) d}\\ \end {align*}
________________________________________________________________________________________
Mathematica [A] time = 0.38, size = 191, normalized size = 1.62 \[ \frac {\sqrt {a^2-b^2} \left (a (a-b \sin (c+d x))-\left (a^2-b^2\right ) \cos (c+d x) \left (\log \left (\cos \left (\frac {1}{2} (c+d x)\right )\right )-\log \left (\sin \left (\frac {1}{2} (c+d x)\right )\right )\right )\right )+2 b^3 \cos (c+d x) \tan ^{-1}\left (\frac {a \tan \left (\frac {1}{2} (c+d x)\right )+b}{\sqrt {a^2-b^2}}\right )}{a d (a-b) (a+b) \sqrt {a^2-b^2} \left (\cos \left (\frac {1}{2} (c+d x)\right )-\sin \left (\frac {1}{2} (c+d x)\right )\right ) \left (\sin \left (\frac {1}{2} (c+d x)\right )+\cos \left (\frac {1}{2} (c+d x)\right )\right )} \]
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
fricas [A] time = 1.00, size = 457, normalized size = 3.87 \[ \left [\frac {\sqrt {-a^{2} + b^{2}} b^{3} \cos \left (d x + c\right ) \log \left (-\frac {{\left (2 \, a^{2} - b^{2}\right )} \cos \left (d x + c\right )^{2} - 2 \, a b \sin \left (d x + c\right ) - a^{2} - b^{2} - 2 \, {\left (a \cos \left (d x + c\right ) \sin \left (d x + c\right ) + b \cos \left (d x + c\right )\right )} \sqrt {-a^{2} + b^{2}}}{b^{2} \cos \left (d x + c\right )^{2} - 2 \, a b \sin \left (d x + c\right ) - a^{2} - b^{2}}\right ) + 2 \, a^{4} - 2 \, a^{2} b^{2} - {\left (a^{4} - 2 \, a^{2} b^{2} + b^{4}\right )} \cos \left (d x + c\right ) \log \left (\frac {1}{2} \, \cos \left (d x + c\right ) + \frac {1}{2}\right ) + {\left (a^{4} - 2 \, a^{2} b^{2} + b^{4}\right )} \cos \left (d x + c\right ) \log \left (-\frac {1}{2} \, \cos \left (d x + c\right ) + \frac {1}{2}\right ) - 2 \, {\left (a^{3} b - a b^{3}\right )} \sin \left (d x + c\right )}{2 \, {\left (a^{5} - 2 \, a^{3} b^{2} + a b^{4}\right )} d \cos \left (d x + c\right )}, -\frac {2 \, \sqrt {a^{2} - b^{2}} b^{3} \arctan \left (-\frac {a \sin \left (d x + c\right ) + b}{\sqrt {a^{2} - b^{2}} \cos \left (d x + c\right )}\right ) \cos \left (d x + c\right ) - 2 \, a^{4} + 2 \, a^{2} b^{2} + {\left (a^{4} - 2 \, a^{2} b^{2} + b^{4}\right )} \cos \left (d x + c\right ) \log \left (\frac {1}{2} \, \cos \left (d x + c\right ) + \frac {1}{2}\right ) - {\left (a^{4} - 2 \, a^{2} b^{2} + b^{4}\right )} \cos \left (d x + c\right ) \log \left (-\frac {1}{2} \, \cos \left (d x + c\right ) + \frac {1}{2}\right ) + 2 \, {\left (a^{3} b - a b^{3}\right )} \sin \left (d x + c\right )}{2 \, {\left (a^{5} - 2 \, a^{3} b^{2} + a b^{4}\right )} d \cos \left (d x + c\right )}\right ] \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
giac [A] time = 0.21, size = 135, normalized size = 1.14 \[ \frac {\frac {2 \, {\left (\pi \left \lfloor \frac {d x + c}{2 \, \pi } + \frac {1}{2} \right \rfloor \mathrm {sgn}\relax (a) + \arctan \left (\frac {a \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + b}{\sqrt {a^{2} - b^{2}}}\right )\right )} b^{3}}{{\left (a^{3} - a b^{2}\right )} \sqrt {a^{2} - b^{2}}} + \frac {\log \left ({\left | \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) \right |}\right )}{a} + \frac {2 \, {\left (b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - a\right )}}{{\left (a^{2} - b^{2}\right )} {\left (\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} - 1\right )}}}{d} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
maple [A] time = 0.44, size = 130, normalized size = 1.10 \[ -\frac {1}{d \left (a +b \right ) \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )}+\frac {\ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{a d}+\frac {1}{d \left (a -b \right ) \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )}+\frac {2 b^{3} \arctan \left (\frac {2 a \tan \left (\frac {d x}{2}+\frac {c}{2}\right )+2 b}{2 \sqrt {a^{2}-b^{2}}}\right )}{d \left (a -b \right ) \left (a +b \right ) a \sqrt {a^{2}-b^{2}}} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
maxima [F(-2)] time = 0.00, size = 0, normalized size = 0.00 \[ \text {Exception raised: ValueError} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
mupad [B] time = 12.88, size = 659, normalized size = 5.58 \[ \frac {a^6\,\cos \left (c+d\,x\right )+a^6+a^2\,b^4-2\,a^4\,b^2+a^6\,\cos \left (c+d\,x\right )\,\ln \left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )-b^6\,\cos \left (c+d\,x\right )\,\ln \left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )+a^2\,b^4\,\cos \left (c+d\,x\right )-2\,a^4\,b^2\,\cos \left (c+d\,x\right )+2\,a^3\,b^3\,\sin \left (c+d\,x\right )-a\,b^5\,\sin \left (c+d\,x\right )-a^5\,b\,\sin \left (c+d\,x\right )+3\,a^2\,b^4\,\cos \left (c+d\,x\right )\,\ln \left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )-3\,a^4\,b^2\,\cos \left (c+d\,x\right )\,\ln \left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )+b^3\,\cos \left (c+d\,x\right )\,\mathrm {atan}\left (\frac {a^4\,\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,\sqrt {-a^6+3\,a^4\,b^2-3\,a^2\,b^4+b^6}\,1{}\mathrm {i}+b^4\,\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,\sqrt {-a^6+3\,a^4\,b^2-3\,a^2\,b^4+b^6}\,4{}\mathrm {i}-a^2\,b^2\,\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,\sqrt {-a^6+3\,a^4\,b^2-3\,a^2\,b^4+b^6}\,3{}\mathrm {i}+a\,b^3\,\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,\sqrt {-a^6+3\,a^4\,b^2-3\,a^2\,b^4+b^6}\,2{}\mathrm {i}-a^3\,b\,\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,\sqrt {-a^6+3\,a^4\,b^2-3\,a^2\,b^4+b^6}\,1{}\mathrm {i}}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,a^7+2\,\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,a^6\,b-3\,\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,a^5\,b^2-7\,\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,a^4\,b^3+4\,\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,a^3\,b^4+9\,\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,a^2\,b^5-2\,\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,a\,b^6-4\,\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,b^7}\right )\,\sqrt {-a^6+3\,a^4\,b^2-3\,a^2\,b^4+b^6}\,2{}\mathrm {i}}{a\,d\,\cos \left (c+d\,x\right )\,\left (a^2-b^2\right )\,\left (a^4-2\,a^2\,b^2+b^4\right )} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
sympy [F] time = 0.00, size = 0, normalized size = 0.00 \[ \int \frac {\csc {\left (c + d x \right )} \sec ^{2}{\left (c + d x \right )}}{a + b \sin {\left (c + d x \right )}}\, dx \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________